package com.auto.api.common.entity;

import com.auto.api.common.utils.JsonMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.io.Serializable;
import javax.validation.constraints.NotNull;

/**
 * @program:
 * @description:
 * @author: liangshf
 * @create: 2022-01-06
 */
public class IdObj implements Serializable {

    private static final long serialVersionUID = 1383972723821810054L;

    @NotNull(message = "id不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    public Long getId() {
        return id;
    }

    public static IdObj create(Long id) {
        IdObj idObj = new IdObj();
        idObj.setId(id);
        return idObj;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + ": " + JsonMapper.toJson(this);
    }


}